﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace TCHSHue.BLL
{
    public class Ultil
    {
        string pathFile = "";
        public Ultil(string pathFile)
        {
            this.pathFile = pathFile;
        }
        public void GuestOnline()
        {
            if (!File.Exists(pathFile))
            {
                File.Create(pathFile);
                StreamWriter writer = new StreamWriter(pathFile);
                writer.Write(1);
                writer.Close();
            }
            else
            {
                StreamReader reader = new StreamReader(pathFile);
                int count = int.Parse(reader.ReadLine());
                count++;
                reader.Close();
                StreamWriter writer = new StreamWriter(pathFile);
                writer.Write(count);
                writer.Close();
            }
        }
        public int GetTotal()
        {

            StreamReader reader = new StreamReader(pathFile);
            return int.Parse(reader.ReadLine());
        }
    }
}